<!-- BaiDuWebVideo.html -->
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
	<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<title>百度云视频播放器</title>
</head>
<body>
</body>

<script type="text/javascript">
	apiready = function(){
		hideStatusBar();
		setupNotifi();
		setupBaiDuVideo();
	}
	function hideStatusBar(){
		api.setFullScreen({
			fullScreen: true
		});
	}
	function showStatusBar(){
		api.setFullScreen({
			fullScreen: false
		});
	}
	function setupBaiDuVideo(){

		var width = $(window).height();
		var height = $(window).width();
		api.openFrame({
			name: 'HTML5VideoPlayer',
			url: 'https://cjrh.cfnet.org.cn//index/index/appbaidu?url='+ api.pageParam.url,
			// url: 'appbaidu.html',
			rect: {
				x: 0,
				y: 0,
				w:width,
				h: height
			},
			pageParam:{
				"url":api.pageParam.url
			}
		});
		api.setScreenOrientation({orientation:"landscape_left"});

		//安卓下默认横屏
		// if (api.systemType != 'ios') {

		// }
	}
	function setupNotifi(){
		api.addEventListener({
			name: 'keyback'
		}, function(ret, err) {
			backClick();
		});
		api.addEventListener({
			name:'closeWin',
		},function (ret,err) {
			backClick();
		});
	}

	function backClick(){
		showStatusBar();
		api.setScreenOrientation({orientation:"portrait_up"});
		api.sendEvent({
			name: 'baiduWebVideoBackNotifi',
			extra: api.pageParam
		});
		// setupPlayFinish();
		api.closeWin();
	}
	function setupPlayFinish(){
		var position = currentPlayer.getPosition();
		var duration = currentPlayer.getDuration();
		if (position == duration) {
			api.sendEvent({
				name: 'videoPlayFinishNotifi',
				extra: api.pageParam
			});
		}
	}
</script>
</html>